<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include("includes/appheader.php");
include ("includes/functions.php");

$city=$_GET['city'];
$propertyType=$_GET['propertyType'];
$offerType=$_GET['offerType'];
$priceFrom=$_GET['fromPrice'];
$priceTo=$_GET['toPrice'];

if($propertyType == 1){
  $properties=getApartments($city,$offerType,$propertyType,$priceFrom,$priceTo);
}else{
  $properties=getLastProperties();
}

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>\n";
?>
<properties>
<?php 
    foreach($properties as $property){
        echo "<property id=\"".$property['id']."\" type=\"".$property['type']."\" offerType=\"".$property['offertype']."\" date=\"".$property['registerdate']."\" area=\"".$property['area']."\" price=\"".$property['price']."\" details=\"".$property['details']."\" city=\"".$property['city']."\" lat=\"".$property['lat']."\" lng=\"".$property['lng']."\" />\n";   
    }
?>
</properties>